import { apiGet, apiPost } from '../func/fetch'
import type { AirlineLogoForm, AirlineLogoPage, AirlineLogoPageResult, CommunicationMsg, FlightPlanLogData, FlightPlanLogPage } from './type'
import type { PageResult } from '@/api/global.ts'
import { ContentType } from '@/api/global.ts'

const _api = import.meta.env.VITE_FACEID_URL
// <-- 系统配置 -->
// 航空公司管理-航空公司名称列表
export const airlineLogoListApi = (): Promise<AirlineLogoPageResult[]> => {
  return apiPost(`${_api}/airlineLogo/list`)
}
// 航空公司管理-分页查询
export const airlineLogoPageApi = (params: AirlineLogoPage): Promise<PageResult<AirlineLogoPageResult>> => {
  return apiPost(`${_api}/airlineLogo/page`, params)
}
// 航空公司管理-新增
export const airlineLogoSaveApi = (params: AirlineLogoForm): Promise<null> => {
  return apiPost(`${_api}/airlineLogo/save`, params, ContentType.MULTIPART_FORM_DATA)
}
// 航空公司管理-编辑
export const airlineLogoUpdateApi = (params: AirlineLogoForm): Promise<null> => {
  return apiPost(`${_api}/airlineLogo/update`, params, ContentType.MULTIPART_FORM_DATA)
}
// 航空公司管理-删除
export const airlineLogoDeleteApi = (params: { id: string }): Promise<null> => {
  return apiPost(`${_api}/airlineLogo/delete`, params)
}
// 航班下发日志查询
export const flightPlanLogPageApi = (params: FlightPlanLogPage): Promise<PageResult<FlightPlanLogData>> => {
  return apiGet(`${_api}/flightPlanLog/page`, params)
}
// AIOT日志下发
export const communicationMsgApi = (params: FlightPlanLogPage): Promise<PageResult<CommunicationMsg>> => {
  return apiGet(`${_api}/communicationMsg/page`, params)
}
